$(function () {
   $.ajax({
        
        url: OA_SERVER_NAME+"cxf/noc/getnotice/getinfo",
        type:'get',
        dataType: 'json',
        contentType: 'application/json',
        data: { "ggid" : $.getUrlQueryValue('ggid') },
        success: function (data) {
        	$('#noticeDetailBody').html("");
        	//发布人名详情
        	$("#fbr").html(data.reponseInfo[0].departmentname);
        	
        	//发布时间
        	$("#fbdate").html(data.reponseInfo[0].docvaliddate +'&nbsp'+'&nbsp'
                    +data.reponseInfo[0].docvalidtime);
        	//标题
        	$("#table_file").html(data.reponseInfo[0].docsubject);
        	//内容
        	$("#content").html(data.reponsetxt[0].doccontent);
        
        	
        	
        	/*	//消息类型
        	//$("#category").html(data.reponseParam.category);
        	//发布人
        	//$("#fbrempName").html(data.reponseParam.fbrempName);
         * //保持时间
        	//$("#zhgexdate").html(data.reponseParam.saveDate);
        	//点击次数
        	//$("#cyl").html(data.reponseParam.clicktimes);
         * //图片URL
        	$("#pictureurl").html(data.reponseParam.pictureurl);
        	//文件URL
        	$("#fileurl").html(data.reponseParam.fileurl);
        	//
        	$("#iscallsign").html(data.reponseParam.iscallsign);
        	//阅读标记
        	$("#isreadsign").html(data.reponseParam.isreadsign);
        	//
        	$("#tpsm").html(data.reponseParam.tpsm);
        	//点击量
        	$("#clicktimes").html(data.reponseParam.clicktimes);
        	//
        	$("#totalcomments").html(data.reponseParam.totalcomments);
        	//
        	$("#fbrempid").html(data.reponseParam.fbrempid);
        	//
        	$("#videourl").html(data.reponseParam.videourl);
        	//是否是哦
        	$("#sfvideo").html(data.reponseParam.sfvideo);
        	//紧急公告
        	$("#jjgg").html(data.reponseParam.jjgg);
        	//
        	$("#ggfwname").html(data.reponseParam.ggfwname);
        	//公告
        	$("#ggfw").html(data.reponseParam.ggfw);
        	//是否置顶
        	$("#istop").html(data.reponseParam.istop);
        	//公告ID
        	$("ggid").html(data.reponseParam.ggid);
        	//栏目ID
        	$("lmid").html(data.reponseParam.lmid);
        	//文件下载
        	$("fileNewName").html(data.reponseParam.fileNewName);*/
        	
        	//图片
			var img = $("<img/>");
			img.attr({
				//"src":FILE_DOWNLOAD_URL + fileNewName,
				
			});
			$("#content").before(img);
        	var downAllArr = new Array();
        	var fileCount = 0;
        	$.each(data.reponseExt,function(index,item){
        		
        			
        		
        			fileCount++;
        			//附件
        			var $downLi = $('<li class="file-item"><a javascript="void(0)"></a></li>');
        			var $downA = $downLi.find("a");
        			$downA.html(item.imagefilename);
        			$downA.attr({
            			"href": item.downurl,
            			"download":item.imagefilename
    				});
            		downAllArr.push($downA);
            		$("#fileBody").append($downLi);
        		
        	});
        	//附件显示情况
        	$('#fileCount').html(fileCount == 0 ? '无':fileCount);
        	if(fileCount == 0){
                $('.file-list .dropdown-menu').css({
                    'display':'none'
                });
        	   $('#downAll').hide();
        	}
        	
			$('#downAll').click(function(){
				
				$.each(downAllArr, function(index, item){
					window.open(item.attr('href'));
				});
			});	
        }
    });
    /*页面高度*/
    $('.file-list .dropdown-toggle').click(function(){
        var _h = $('.notice-moudle').outerHeight();
        var add_h = $('.file-list .dropdown-menu').outerHeight();
        if($('.file-list').hasClass('open')){
            $('.notice-moudle').css('height',_h-add_h+'px');
        }else{
            $('.notice-moudle').css('height',_h+add_h+'px');
        }
    });
});
